const express = require("express");
const mongoose = require("mongoose");
const handleschema = require("./handleschema")

new Promise((resolve,reject)=>{
    mongoose.connect("mongodb://localhost:27020",(error)=>{
        if(!error){
            console.log("数据库连接成功")
            resolve()
        }else{
            console.log("数据库连接失败")
        }
    })
})
.then(
    ()=>{
        const server = express();

        handleschema

        server.listen(8080,"localhost",(error)=>{
            if(!error){
                console.log("启动成功")
            }else{
                console.log("启动失败")
            }
        })
    }
)